import axiosExtra from 'axios-extra'
import request from '@/utils/request'


const httpExtra = axiosExtra.create({
  maxConcurrent: 5, //并发为1
  queueOptions: {
    retry: 3, //请求失败时,最多会重试3次
    retryIsJump: false //是否立即重试, 否则将在请求队列尾部插入重试请求
  }
})



export {httpExtra}



export function initTask(data){
  return request({
    url: '/minio/tasks',
    headers: {
      isToken: true
    },
    data:data,
    methods:'post'
  })
}

export function taskInfo(identifier){
  return request({
    url: `/minio/tasks/${identifier}`,
    headers: {
      isToken: true
    },
    methods:'get'
  })
}

export function preSignUrl(identifier,partNumber){
  return request({
    url: `/minio/tasks/${identifier}/${partNumber}`,
    headers: {
      isToken: true
    },
    methods:'get'
  })
}

export function merge(identifier){
  return request({
    url: `/minio/tasks/merge/${identifier}`,
    headers: {
      isToken: true
    },
    methods:'post'
  })
}
